<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta
    http-equiv="X-UA-Compatible"
    content="IE=edge"
  >
  <meta
    name="viewport"
    content="width=device-width, initial-scale=1.0"
  >
  <title>jquery</title>
  <script src="./jquery.min.js"></script>
</head>

<body>
  <p>我是一个p标签</p>
  <button id="hide">点击消失</button> <button id="show">点击显示</button>
  <button class="btn">点击获取数据</button>
  <ul>
    <li>
      <img src="">
    </li>
  </ul>
</body>

</html>
<script type="text/javascript">
  $("#hide").click(function () {
    $("p").hide();
  });

  $("#show").click(function () {
    $("p").show();
  });
  $(".btn").click(function () {
    $.post("https://appapi.yuanfuda933.com/api/v3/activity/list",
      {
        id: 63
      },
      function (res, status) {
        var data = JSON.parse(res)
        var serve = data.data.types[0].goods
        console.log(serve);
        var str = '';
        for (var i = 0; i < serve.length; i++) {
          str +=
            '<li>' +
            '<img src = " + serve[i]goods_img + ">' +
            '</li>'
          console.log(serve[i].goods_img);
        }
        $('li').html(str);
        // $.each(serve, function(index, value) {

        // });
        console.log(status);
      });
  });
  // var json = [{ top: '400px' }, { width: '500px' }, { height: '300px' }];
  var json = { top: '400px', width: '500px', height: '300px' };
  var datas = [];
  datas.push(json);
  // for (key in json) {
  //   var data = {};//每次循环的时候，新建对象
  //   data.k = json[key]
  //   datas.push(data);
  // }
  console.log(datas)
  var a = 1;
  let obj = {
    a: 2,
    foo: function () {
      var that = this
      function b() {
        console.log(that.a);
      }
      b();
    }
  }
  obj.foo()
  let a = 1
  console.log(this.a);
</script>